﻿@model GNSystem.Models.Thread

@{
    ViewBag.Title = "Details";
    var db = (ViewBag.Context as GNSystem.Models.DataContext);
    var posts = db.Posts.Where(p => p.ThreadID == Model.ID).OrderBy(p => p.CreationTime).ToList();
    int uid = (int)ViewBag.UID;
}

@*<h2>@Model.Subject</h2>*@

<table>
    <tr>
        <td>
            @GNSystem.Helpers.Forum.Thread(Model, db, Model.UserID)
        </td>
    </tr>
    @foreach (var item in posts)
    {
        <tr>
            <td>
                @GNSystem.Helpers.Forum.Post(item, db, uid)
            </td>
        </tr>
    }
</table>

<p>
    @Html.ActionLink("Edit", "Edit", new { id=Model.ID }) |
    @Html.ActionLink("Back to List", "Index")
</p>
